package com.xiaoshuidi.cloud.module.bpm.framework.config;

import com.xiaoshuidi.cloud.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import com.xiaoshuidi.cloud.module.bpm.dal.dataobject.reserveticket.ReserveTicketDO;
import com.xiaoshuidi.cloud.module.bpm.dal.dataobject.swo.SwoTicketDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
public class DataPermissionConfiguration {

    @Bean
    public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizer() {
        return rule -> {
            // dept 基于部门的数据权限
            rule.addDeptColumn(SwoTicketDO.class, "dept_id"); // WHERE id = ?
            rule.addDeptColumn(ReserveTicketDO.class, "dept_id"); // WHERE id = ?
        };
    }

}
